package demo05;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2022-04-10
 * Time: 20:26
 */
//5.
public class TestDemo06 {
    public static void main(String[] args) {
        int [] a = {0,1,2,3,4};
        for (int i = 0; i <=5; i++) {
            try {
                int t = a[i] / i;
            } catch (ArrayIndexOutOfBoundsException e) {
                System.out.println("数组越界 " + e);
            } catch(ArithmeticException e) {
                System.out.println("除法时分母为" + e);
            } catch (Exception e) {
                System.out.println("捕获" + e + "异常");
            } finally {
                System.out.println("finally i =" + i);
            }
        }
    }
}
